package com.xxy.partnermatch.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * ClassName: SwaggerConfig
 * Package: com.xxy.usercenter
 * Description: Swagger 配置类
 *
 * @Author 十一
 * @Create 2024/11/14 15:43
 * @Version 1.0
 */
@Configuration
public class SwaggerConfig {

    /**
     * 限定配置仅在部分环境开启, 确保线上环境访问不到 Swagger
     * @return
     */
    @Profile({"dev", "test"})
    @Bean
    public OpenAPI docsOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .summary("xuxuanya")
                        .title("伙伴匹配系统-API接口")
                        .description("伙伴匹配系统-接口文档")
                        .version("v0.0.2")
                        .license(new License().name("Apache 2.0").url("https://springdoc.org")))
                .externalDocs(new ExternalDocumentation()
                        .description("xuxuanya I Love You")
                        .url("https://xuxuanya.love"));
    }

}
